{% extends 'base_tabler.html' %}

{% block content %}
<div class="container mt-5">
  <div class="row justify-content-center">
    <div class="col-md-8">
      <div class="card">
        <div class="card-body">
          <h2 class="card-title text-center mb-4">欢迎, {{ user.username }}!</h2>
          <p class="text-muted text-center">这是您的后台管理页面。</p>
          <div id="chart" class="chart-container" style="width:100%;height:400px;"></div>
          {{ chart|safe }}

          <div class="mt-5">
            <h3 class="text-center mb-4">文件上传</h3>
            <form method="post" action="{% url 'upload' %}" enctype="multipart/form-data" class="mb-4">
              {% csrf_token %}
              <div class="mb-3">
                <input type="file" class="form-control" name="file">
              </div>
              <div class="d-grid">
                <button type="submit" class="btn btn-primary">上传文件</button>
              </div>
            </form>

            <form method="post" action="{% url 'logout' %}">
              {% csrf_token %}
              <div class="d-grid">
                <button type="submit" class="btn btn-outline-danger">退出登录</button>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}